#define _CRT_SECURE_NO_WARNINGS 1

struct my_Sort
{
    bool operator()(const string& s1, const string& s2) const
    {
        return (s1 + s2) < (s2 + s1);
    }
};

class Solution {
public:
    string largestNumber(vector<int>& nums) {
        priority_queue<string, vector<string>, my_Sort> heap;
        for (auto& e : nums) heap.push(to_string(e));
        string ret;
        while (heap.size())
        {
            ret += heap.top();
            heap.pop();
        }

        return ret[0] == '0' ? "0" : ret;
    }
};